package org.example.ecsp.servers.controller;
import lombok.extern.slf4j.Slf4j;
import org.example.ecsp.base.response.JsonResult;
import org.example.ecsp.servers.pojo.dto.ServersQuery;
import org.example.ecsp.servers.pojo.dto.ServersSaveParam;
import org.example.ecsp.servers.pojo.entity.Servers;
import org.example.ecsp.servers.pojo.vo.ServersVO;
import org.example.ecsp.servers.service.ServersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Slf4j
@RestController
@RequestMapping("/v1/server")
public class ServersController {

    @Autowired
    ServersService serversService;
    @GetMapping("select")
    public JsonResult selectServers(ServersQuery serversQuery){
        log.debug("查询家政人员:参数={}",serversQuery);
    List<ServersVO> list= serversService.selectServers(serversQuery);
    return JsonResult.ok(list);
}
@PostMapping("save")
    public JsonResult save( ServersSaveParam serversSaveParam){
        log.debug("新增家政人员:参数={}",serversSaveParam);
    serversService.save(serversSaveParam);
    return JsonResult.ok();
}
@PostMapping("update/status/{userId}/{status}")
    public JsonResult updateStatus(@PathVariable Long userId,@PathVariable String status){
        log.debug("修改家政人员状态:参数={},{}",userId,status);
    serversService.updateById(userId,status);
    return JsonResult.ok();
}
}
